<template>
	<view :class="model+'-wrap'">
		<view :class="'p-sticky-'+model" :style="model=='light'?'background:#fff':''">
			<view class="status_bar">

			</view>
			<view class="nav_bar flex align-center justify-between">
				<view class="flex-1">
					<view @click="$tool.goBack()" class="f0 p-3">
						<image class="fanhui_icon" :src="'/static/images/fanhui_'+model+'.png'" mode=""></image>
					</view>
				</view>
				<view class="A-Medium" :class="'navTitle_'+model">
					{{i18n.p043}}
				</view>
				<view class="flex-1">
				</view>
			</view>
		</view>
		<view class="orderList A-Medium" style="margin-top: 14rpx;" :class="model=='light'?'orderListLight':''">

			<view v-for="(item,index) in orderList2"
				:style="item.orderStatus==0?'':'background: url(/static/images/yidaoqi.png);background-size: 180rpx 180rpx;background-repeat: no-repeat;background-position: 240rpx 100%;'"
				class="orderItem mx-3" style="margin-bottom: 12rpx;">
				<!-- 单号 -->
				<view class="flex text1 align-center justify-between" style="margin-bottom: 6rpx;">
					<view class="">
						{{i18n10.n131}}
					</view>
					<view class="">
						{{item.orderNo}}
					</view>
				</view>
				<!-- 储蓄池名称 -->
				<view class="flex text1 align-center justify-between" style="margin-bottom: 6rpx;">
					<view class="">
						{{i18n10.n132}}
					</view>
					<view class="">
						{{item.coinType}}
					</view>
				</view>
				<!-- 存入金额 -->
				<view class="flex text1 align-center justify-between" style="margin-bottom: 6rpx;">
					<view class="">
						{{i18n10.n133}}
					</view>
					<view class="">
						{{item.depositAmount}} {{item.coinType}}
					</view>
				</view>
				<!-- 存入天数 -->
				<view class="flex text1 align-center justify-between" style="margin-bottom: 6rpx;">
					<view class="">
						{{i18n10.n134}}
					</view>
					<view class="">
						{{item.period}} {{i18n10.n135}}
					</view>
				</view>
				<!-- 预期收益 -->
				<view class="flex text1 align-center justify-between" style="margin-bottom: 6rpx;">
					<view class="">
						{{i18n10.n136}}
					</view>
					<view class="" style="color: #D22540;">
						{{item.yield}}%
					</view>
				</view>
				<!-- 存入时间 -->
				<view class="flex text1 align-center justify-between" style="margin-bottom: 6rpx;">
					<view class="">
						{{i18n10.n137}}
					</view>
					<view class="">
						{{item.purchaseDate}}
					</view>
				</view>
				<!-- 开始收益 -->
				<view class="flex text1 align-center justify-between" style="margin-bottom: 6rpx;">
					<view class="">
						{{i18n2.t039}}
					</view>
					<view class="">
						{{item.yieldStartDate}}
					</view>
				</view>
				<!-- 到期时间 -->
				<view class="flex align-center justify-between" style="margin-bottom: 6rpx;">
					<view class="text1">
						{{i18n10.n138}}
					</view>
					<view class="text1">
						{{item.maturityDate}}
					</view>
				</view>
				<!-- 订单状态 -->
				<view class="flex text1 align-center justify-between">
					<view class="">
						{{i18n10.n139}}
					</view>
					<view class="" :style="item.orderStatus==0?'color: #82DA4C;':''">
						{{item.orderStatus==0?'进行中':'已到期'}}
					</view>
				</view>
			</view>
		</view>
		<view class="A-Medium text-alignC" style="font-size: 24rpx;color: #7F838D;">
			{{i18n.p023}}～
		</view>
	</view>
</template>

<script>
	import {
		liquidityCisternList
	} from '@/core/api/index.js';
	export default {
		data() {
			return {
				coinType: '',
				pageNo2: 1,
				pageSize2: 15,
				orderList2: [],
			}
		},
		onReady() {
			this.$tool.setStatusBarStyle(this.model);
		},
		onShow() {
			this.$tool.setStatusBarStyle(this.model);
			const pages = getCurrentPages();
			const page = pages[pages.length - 1];
			const currentWebview = page.$getAppWebview();
			if(this.model == "dark"){
				currentWebview.setStyle({
					background: "#0E0F11"
				});
			}else{
				currentWebview.setStyle({
					background: "#ffffff"
				});
			}
		},
		onLoad(options) {
			this.coinType = options.coinType;
			this.getLiquidityCisternList();
		},
		computed: {
			i18n() {
				return this.$t('property');
			},
			i18n2() {
				return this.$t('trade')
			},
			i18n10() {
				return this.$t('newObj');
			},
			model() {
				return this.$store.state.config.model;
			}
		},
		onReachBottom() {
			this.pageNo2++;
			this.getLiquidityCisternList();
		},
		methods: {
			getLiquidityCisternList() {
				liquidityCisternList({
					coinType: this.coinType,
					pageNo: this.pageNo2,
					pageSize: this.pageSize2,
					mobileUserId: uni.getStorageSync('mobileUserId'),
					orderStatus: ''
				}).then(res => {
					let list = res.result.records;
					if (this.pageNo2 == 1) {
						this.orderList2 = list;
					} else {
						if (list.length == 0) {
							this.pageNo2--;
						} else {
							this.orderList2.push(...list);
						}
					}
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.selectWrap {
		background: #0E0F11;

		.title {
			height: 34rpx;
			line-height: 34rpx;
			font-size: 24rpx;
			color: #F7F7F7;
		}

		.titleLight {
			color: #0E0F11;
		}
	}

	.selectWrapLight {
		background: #E6E8EF;
	}

	.orderList {
		.orderItem {
			padding: 24rpx 30rpx;
			background: #16181C;
			border-radius: 30rpx 30rpx 30rpx 30rpx;
			border: 2rpx solid #1F2128;

			.text1 {
				font-size: 24rpx;
				color: #7F838D;
			}

			.text2 {
				font-size: 28rpx;
				color: #F7F7F7;
			}

			.text3 {
				font-size: 24rpx;
				color: #F7F7F7;
			}

			.icon {
				width: 20rpx;
				height: 20rpx;
				background: #F7F7F7;
				margin-right: 8rpx;
			}

			.icon2 {
				width: 20rpx;
				height: 20rpx;
				background: #7F838D;
				margin-right: 8rpx;
			}

			.label {
				padding: 2rpx 10rpx;
				border-radius: 30rpx;
				border: 1rpx solid #82DA4C;
				font-size: 20rpx;
				color: #82DA4C;
			}

			.price1 {
				font-size: 24rpx;
				color: #E7343F;
			}

			.price2 {
				font-size: 24rpx;
				color: #53D290;
			}

			.price3 {
				font-size: 24rpx;
				color: #82DA4C;
			}
		}
	}

	.orderListLight {
		.orderItem {
			background: #FFFFFF;
			border: 2rpx solid #fff;

			.text1 {
				font-size: 24rpx;
				color: #7F838D;
			}

			.text2 {
				color: #0E0F11;
			}

			.text3 {
				color: #0E0F11;
			}

			.icon {
				width: 20rpx;
				height: 20rpx;
				background: #0E0F11;
				margin-right: 8rpx;
			}

			.label {
				padding: 2rpx 10rpx;
				border-radius: 30rpx;
				border: 1rpx solid #82DA4C;
				font-size: 20rpx;
				color: #82DA4C;
				background: #fff;
			}
		}
	}
</style>